# -*- coding: utf-8 -*-

import os


# from vsogame.database import Model
class Config(object):
    SECRET_KEY = 'NGUzMjc0MjBiYzQxMjkyZTgyZTk5ZTA2MDg2MDU1NDsd'

    # CSRF
    WTF_CSRF_ENABLED = False

    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # PEEWEE_DATABASE_URI = 'postgres+pool://postgres:llei1016@localhost/postgres'

    PEEWEE_DATABASE_URI = 'sqlite:///vsogame.db'
    # PEEWEE_CONNECTION_PARAMS = {'charset': 'utf8mb4'}

    # Path to directory which contains migrations
    PEEWEE_MIGRATIONS = 'migrations'

    # Path to module which contains you applications' Models
    # Needed by automatic migrations
    PEEWEE_MODELS_MODULE = 'models'

    # Models which should be ignored in migrations
    PEEWEE_MODELS_IGNORE = []

    # Base models class
    # Use `db.Model` as your models' base class for automatically DB binding
    # PEEWEE_MODELS_CLASS = Model

    # Don't connect to db when request starts and close when it ends automatically
    PEEWEE_MANUAL = False

    # QINIU
    QINIU_ACCESS_KEY = 'KK6kLwnn8SEvnBhZYP_ClCGpRhC_wDErdX9AAfu2'
    QINIU_SECRET_KEY = 'GsywpXKeIwY4Ig5oVdi-8C1fCI3yBVyR7sruUT3Q'
    QINIU_BUCKET_NAME = 'iwillgoo_core-images'
    QINIU_BASE_URL = 'http://7xrkxm.com1.z0.glb.clouddn.com'
    ACCESS_TOKEN_STORE_URL = 'redis://:dE592avrNmxqad8u@app1.iwillgoo.com/5'

    PAYMENT_CLIENT_ID = '6g4yhhcjsj3ancoy6deqbn'
    PAYMENT_CLIENT_SECRET = '6youcfjfyonfmnr7qk4tbp'
    PAYMENT_ENDPOINT = 'http://hk.uniteweb.net:46000'


class DevelopmentConfig(Config):
    DEBUG = True
    REDIS_URL = 'redis://:dE592avrNmxqad8u@app1.iwillgoo.com/5'
    SQLALCHEMY_DATABASE_URI = 'sqlite:///vsogame3.sqlite'
    # SQLALCHEMY_POOL_SIZE = 3
    # SQLALCHEMY_POOL_RECYCLE = 20
    # SQLALCHEMY_POOL_TIMEOUT = 5000
    # SQLALCHEMY_MAX_OVERFLOW = 1000
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    PAYMENT_CLIENT_ID = 'f4xx8pfgr5ryv7gjyxuwzh'
    PAYMENT_CLIENT_SECRET = 'rzmynsmgfmjzwr3t9cadbg'
    PAYMENT_ENDPOINT = 'http://localhost:5001'


class TestingConfig(Config):
    TESTING = True

    PAYMENT_ENDPOINT = 'http://vsogame-api.uniteweb.net:46000'
    REDIS_URL = os.getenv('REDIS_URL')
    PEEWEE_DATABASE_URI = os.getenv('DATABASE_URL')


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'mysql://mo:no@mysql/iwillgoo_core?max_connections=20&stale_timeout=300 '

    REDIS_URL = os.getenv('REDIS_URL')
    # SENTRY
    SENTRY_DSN = 'https://fec55df28cb748ea80711cd09acd81bb:8866804d20ef49d8a9fcd5aeaa7cda12@app.getsentry.com/70628'  # noqa


config = {
    'default': DevelopmentConfig,
    'development': DevelopmentConfig,
    'testing': TestingConfig,
    'production': ProductionConfig
}
